package com.bc004346.travelus.Adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.bc004346.travelus.R;

/**
 * Created by Renats on 5/31/2014.
 * Travel alert adapter
 */
public class NoticesAdapter extends ArrayAdapter<String> {

    private final Context context;
    private final String[] values;

    public NoticesAdapter(Context context, int resource, String[] objects) {
        super(context, resource, objects);
        this.context = context;
        this.values = objects;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        LayoutInflater inflater = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View rowView = inflater.inflate(R.layout.list_notices, parent, false);
        TextView textView = (TextView) rowView.findViewById(R.id.list_notice_text);
        textView.setText(values[position]);

        return rowView;
    }
}
